package com.itheima.exception;

import com.itheima.common.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class CheckItemException {
    @ExceptionHandler(RuntimeException.class)
    private Result exc(RuntimeException ex){
        log.error("出现了RuntimeException异常");
      ex.printStackTrace();
      return new Result(false,"系统繁忙，请稍后再试");
    }
    @ExceptionHandler(NullPointerException.class)
    private Result exc1(NullPointerException ex){
        log.error("系统出现了NullPointException异常");
        ex.printStackTrace();
        return new Result(false,"系统繁忙，请稍后再试");
    }
    @ExceptionHandler(Exception.class)
    private Result exc2(Exception ex){
        log.error("出现了Exception异常");
        ex.printStackTrace();
        return new Result(false,"系统繁忙，请稍后再试");
    }
}
